package com.joysuch.wwyt.patrol.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.joysuch.wwyt.patrol.entity.PatrolRecordItem;
import com.joysuch.wwyt.patrol.entity.PatrolTask;
import com.joysuch.wwyt.patrol.entity.dto.ItemCheckResultDto;
import com.joysuch.wwyt.patrol.entity.dto.TaskRecordItemDto;
import com.joysuch.wwyt.patrol.entity.vo.StatTrendListBean;
import com.joysuch.wwyt.patrol.entity.vo.WebTaskRecordItemVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author heqifeng
 * @since 2022-03-03
 */
@Repository
public interface PatrolRecordItemMapper extends BaseMapper<PatrolRecordItem> {

    PatrolTask selectTaskByItemId(Long id);

    List<WebTaskRecordItemVo> getExRecordByTaskId(Long taskId);

    List<WebTaskRecordItemVo> getExItemByRecord(Long recordId);

    Page<TaskRecordItemDto> getTaskRecordItem(Page<TaskRecordItemDto> page,@Param("taskId") Long taskId,@Param("pointName") String pointName,@Param("deviceNameOrCode") String deviceNameOrCode);

    List<ItemCheckResultDto> getItemCheckResultByTaskAndCkProject(@Param("taskIds") List<Long> taskIds, @Param("ckProjectIds")List<Long> ckProjectIds);

    List<StatTrendListBean> listCheckResultByTime(@Param("projectId") Long projectId, @Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("resultField") String resultField, @Param("planId") Long planId);

    List<TaskRecordItemDto> findWfRecordItemList();

    boolean updateWfRecordItemById(String status, String exceptHandel, Long id);

    boolean updateRecordItemRepairStatusAndWfStatus(@Param("id") Long id, @Param("exceptHandel") String exceptHandel,
                                                    @Param("wfProcessInsId") String wfProcessInsId,@Param("wfProcessStatus") String wfProcessStatus);
}
